package com.lovo.cloud.controller;


import com.lovo.cloud.model.dos.Order2DO;
import com.lovo.cloud.model.dto.OrderRateDTO;
import com.lovo.cloud.service.Order2Service;
import com.lovo.cloud.service.OrderRateService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luo
 * @since 2020-12-09
 */
@CrossOrigin
@RestController
@RequestMapping
public class Order2Controller {

    @Resource
    private Order2Service order2Service;

    @Resource
    private OrderRateService orderRateService;

    @GetMapping("/findAllOrder")
    public List<Order2DO> findAllOrder(){
     return order2Service.findAll();
    }

    @PostMapping("/addRate")
    public String addRate(@RequestBody OrderRateDTO orderRateDTO){
        if (orderRateDTO != null) {
            orderRateService.addRate(orderRateDTO);
            return "评论成功";
        }else {
            return "评论失败";
        }

    }

}

